package com.google.gwt.gfx.client.graphics.vml;

import com.google.gwt.gfx.client.graphics.Line;
import com.google.gwt.user.client.DOM;

public class VMLLine extends Line {

	public VMLLine() {
		super(DOM.createElement("v:line"));
	}

	@Override
	protected int getFromLeft() {
		return DOM.getElementPropertyInt(getElement(), "x1");
	}

	@Override
	protected int getFromTop() {
		return DOM.getElementPropertyInt(getElement(), "y1");
	}

	@Override
	protected int getToLeft() {
		return DOM.getElementPropertyInt(getElement(), "x2");
	}

	@Override
	protected int getToTop() {
		return DOM.getElementPropertyInt(getElement(), "y2");
	}

	public void setFrom(int fromX, int fromY) {
		DOM.setElementProperty(getElement(), "from", String.valueOf(fromX)
				+ " " + String.valueOf(fromY));
	}

	@Override
	protected void setFromLeft(int left) {
		DOM.setElementProperty(getElement(), "from", String.valueOf(left) + " "
				+ String.valueOf(getFromTop()));
	}

	@Override
	protected void setFromTop(int top) {
		DOM.setElementProperty(getElement(), "from",
				String.valueOf(getFromLeft()) + " " + String.valueOf(top));
	}

	public void setTo(int toX, int toY) {
		DOM.setElementProperty(getElement(), "to", String.valueOf(toX) + " "
				+ String.valueOf(toY));
	}

	@Override
	protected void setToLeft(int left) {
		DOM.setElementProperty(getElement(), "to", String.valueOf(left) + " "
				+ String.valueOf(getToTop()));
	}

	@Override
	protected void setToTop(int top) {
		DOM.setElementProperty(getElement(), "to", String.valueOf(getToLeft())
				+ " " + String.valueOf(top));
	}

}
